<template>
  <h-modal @ok="ok" @cancel="close"
           okText="确定" cancelText="取消" :visible="visible" title="减签">
    <RowAttribute label="用户节点">
      <Select placeholder="请选择需要减签的流程节点" v-model="userTaskId">
        <SelectOption v-for="item in userTasks" :value="item.id">
          {{ item.taskName }}
        </SelectOption>
      </Select>
    </RowAttribute>
  </h-modal>
</template>
<script>
import HModal from '@/components/HModal/HModal.vue';
import RowAttribute from '@/components/flow/layout/RowAttribute.vue';
import {notification, Select} from 'ant-design-vue';
import {createProps} from '@/utils';

export default {
  name: 'SubtractUserSignModal',
  components: {RowAttribute, HModal, Select, SelectOption: Select.Option},
  props: {
    userTasks: createProps(Array)
  },
  data() {
    return {
      visible: false,
      userTaskId: undefined
    };
  },
  methods: {
    ok() {
      if (!this.userTaskId) {
        notification.warn({message: "请选择需要减签的流程节点"});
        return;
      }
      this.$emit('ok', this.userTaskId);
      this.close();
    },
    open() {
      this.visible = true;
      this.userTaskId = undefined;
    },
    close() {
      this.visible = false;
      this.$emit('close')
    },
  }
};
</script>